package com.beerandjesus.webapp.sportofkings.handicapper.struts.action;

import com.opensymphony.xwork2.validator.annotations.RequiredFieldValidator;
import org.springframework.stereotype.Component;

import java.io.File;

/**
 * Date: Jun 1, 2012
 * Time: 1:57:03 PM
 */
@Component
public class AnalyzeAction extends BaseAnalyzeAction {

    private File fileUpload;
    private String fileName;

    public String execute() throws Exception {
        String filePath = getFileUpload().getAbsolutePath();
        String result = execute(filePath);
        getFileUpload().delete();
        return result;
    }


    public File getFileUpload() {
        return fileUpload;
    }

    @RequiredFieldValidator(message = "Please select a file")
    public void setFileUpload(File fileUpload) {
        this.fileUpload = fileUpload;
    }

    public String getFileName() {
        return fileName;
    }

    public void setFileName(String fileName) {
        this.fileName = fileName;
    }

}
